#include <iostream>

class Person
{
public:
    Person()
    {
        std::cout << "无参构造执行了" << std::endl;
    }

    explicit Person(int age) // 加了explicit 关键字，构造函数就不能隐式调用了
    {
        std::cout << "Person(int) 执行了" << std::endl;
    }

    explicit Person(int age, int score)
    {
        std::cout << "Person(int, int) 执行了" << std::endl;
    }
};

int main(int argc, char const *argv[])
{

    // 显式调用
    std::cout << "显式调用" << std::endl;
    Person p1 = Person();
    Person p2 = Person(1);
    Person p3 = Person(1, 2);

    Person p4;
    Person p5(1);
    Person p6(1, 2);

    // 隐式调用
    std::cout << "隐式调用" << std::endl;

    // Person p7 = {};     // 隐式调用
    // Person p8 = {10};   // 隐式调用
    // Person p81 = 10;    // 隐式调用
    // Person p9 = {1, 2}; // 隐式调用

    Person p71 = Person{1};    // 显式调用
    Person p72 = Person{1, 2}; // 显式调用
    Person p73 = Person{};     // 显式调用

    // 在堆上实例化
    std::cout << "在堆上实例化" << std::endl;
    Person *p10 = new Person;
    Person *P11 = new Person();
    Person *p12 = new Person(10);
    Person *p13 = new Person(10, 12);

    std::cout << "***************" << std::endl;

    Person *p14 = {}; // 创建了一个空指针
    Person *p14_ = NULL;
    std::cout << (p14 == p14_) << std::endl; // true

    std::cout << "##################" << std::endl;
    Person *p15 = new Person{};
    Person *p16 = new Person{1};
    Person *p17 = new Person{1, 2};

    return 0;
}
